package cn.topevery.garden.dal.logic;

import cn.topevery.garden.dal.dao.ProjectProgressDao;
import cn.topevery.garden.entity.po.ProjectProgress;
import cn.topevery.garden.entity.query.ProjectProgressQuery;
import cn.topevery.garden.framework.base.BaseLogic;
import hw.topevery.framework.db.base.BaseEntityDao;
import hw.topevery.framework.db.entity.DataPager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 描述 The type Project progress logic.
 *
 * @author code -generate
 * @created 2021 -09-01 17:53:17
 * @date 2021 -09-01
 */
@Service
public class ProjectProgressLogic extends BaseLogic<ProjectProgress> {
    @Autowired
    ProjectProgressDao projectProgressDao;

    /**
     * 描述 Gets dao.
     *
     * @return the dao
     * @author wenzhao.lin
     * @created 2021 -09-01 17:53:17
     */
    @Override
    public BaseEntityDao<ProjectProgress, Integer> getDao() {
        return projectProgressDao;
    }


    /**
     * 获取列表
     *
     * @param query the query
     * @return the data pager
     * @author wenzhao.lin
     * @created 2021 -09-01 17:53:17 List page data pager.
     */
    public DataPager<ProjectProgress> listPage(ProjectProgressQuery query) {
        return projectProgressDao.listPage(query);
    }

    /**
     * 根据自增id批量删除
     *
     * @param userId the user id
     * @param ids    the ids
     * @author wenzhao.lin
     * @created 2021 -09-01 17:53:17 Delete batch by id.
     */
    public void deleteBatchById(String userId,Integer[] ids) {
        projectProgressDao.delete(userId, ids);
    }

    /**
     * 根据自增id保存或者更新
     *
     * @param userId          the user id
     * @param projectProgress 实体
     * @return the boolean
     * @author wenzhao.lin
     * @created 2021 -09-01 17:53:17 Save or update boolean.
     */
    public boolean saveOrUpdate(String userId, ProjectProgress projectProgress){
        projectProgressDao.saveOrUpdate(userId,projectProgress);
        return true;
    }

    /**
     * 描述 create.
     *
     * @param pid the pid
     * @return the list
     * @author wenzhao.lin
     * @created 2021 -09-01 17:53:17 Get list by pid list.
     */
    public List<ProjectProgress> getListByPid(Integer pid){
        return projectProgressDao.getListByPid(pid);
    }
}
